package snafu.implementation.states.literals.position;

import snafu.framework.states.literals.StateLiteralItself;
import snafu.framework.states.literals.StateLiteralView;
import snafu.framework.view.Access;
import snafu.framework.worlds.Position;

public class PositionLiteralItself extends StateLiteralItself<Position> implements PositionLiteral {
	public PositionLiteralItself(Position value, Access privacy) {
		super(value, privacy);
	}
	
	@Override
	public StateLiteralView<Position> createView(Access access) {
		return new PositionLiteralView(access, this);
	}
	
	@Override
	public boolean equals(Object o) {
		if (!(o instanceof PositionLiteral)) {
			return false;
		}
		PositionLiteral that = (PositionLiteral) o;
		
		Position thatPosition = that.getValue();
		Position thisPosition = this.getValue();
		if (thisPosition == null) {
			return super.equals(o) && thatPosition == null;
		} else {
			return super.equals(o) && thatPosition.equals(thisPosition);
		}
	}
}
